package com.ly.dict.controller;

import com.ly.dict.core.MdictFactory;
import com.ly.dict.domain.R;
import org.noear.solon.annotation.Controller;
import org.noear.solon.annotation.Mapping;
import org.noear.solon.annotation.Param;

import java.io.IOException;
import java.util.List;
import java.util.Map;

@Controller
public class ApiController {

    /**
     * 翻译接口
     *
     * @author leiyuan
     * @since 2025/4/20
     */
    @Mapping("/translate")
    public R translate(@Param() String word) throws IOException {
        List<Map<String, Object>> data = MdictFactory.search(word);

        return R.ok().data(data);
    }

}